Let's add configuration variables to our sponsors so that we can easily change things like intermission
time and round time.
And we also want some sort of flag to turn the sponsor on and off.
Well, the easiest way to do that, come over here to your server script service, open it up and on
your sponsor script, we're going to add the configuration variables directly to it.
So I'll hit this plus here and then hit an I four in value.
And then we got this in value.
It holds integers, right?
It's an object that holds integers.
I'm going to call this intermission and that intermission, I'll just make that 5 seconds just like
it was in this script.
And then I'm going to hit that plus sign again in value.
This is going to be the round.
Here we go round cool.
And then we'll make this value 25.
That's what it was in the script and we'll add another one plus value.
This one will be this is going to be a new one.
We don't have in the script time to live because we're destroying all the zombies at the end of the
loop.
But we might want the zombies to live longer than the loop.
So did you have more than one wave that you have to deal with?
Right.
So let's go to value on that and I'm going to make this 45 seconds slightly longer than my round so
that I could see two sets of zombies in the world.
All right, one more value.
Go here to the Z spawn or hit the plus.
I want to be for Boolean boolean and this is going to say activated, right?
That's going to be true or false Boolean value.
You're just going to select that flag.
So if you haven't checked, that's a true.
If it's not checked, it's a false.
All right, let's go into our code, open up Z spanner and implement those values to scroll up here.
We do have an intermission, but we want to use the one that's on the script in the INT value.
So I'm going to say script colon, wait for child just in case these int values aren't aren't they're
on startup right away or immediately I should say, let's get our intermission and then we'll do another
one for round script.
Colon Wait for child round.
I need time to live.
I'll call that total script.
Colon Wait for child time to live.
And we need our activated, activated script waiting for child activated.
Nice.
All right.
So what I think I'm going to do here.
So intermission was a variable to a number.
Now it's a variable to an invalid.
So in order to get the actual value, you have to do this dot value.
Right.
So if you look at your intermission here, you have that value field.
You have to access the field in order to get the five right.
And then we have the same thing going on for round dot value.
Cool.
We also don't want to destroy our zombies at the end of the round.
We want to give them a different time to live.
I'm going to do that by adding the debris service.
Debris, right.
That's game.
Get service debris.
And then I'm going to delete this line right here.
I'm going to say debris, colon, ad item, and I want to put my zombie folder in there.
So we're not going to kill the zombies off immediately or individually.
We're going to do the whole folder just to keep this a little simpler.
And then I need to get the time to live TTL dot value.
And then what was our total?
I like 45 or something, right?
45 seconds.
Yeah, 45 seconds.
So they'll outlive our round by a little bit.
All right, so intermission is 5 seconds.
I think what I'm going to do is I'm going to make this wild loop periodically run throughout the game,
doing the five second weights in between.
Then if we get an update of our activated flag, so activate a dot value.
So if this is true, we'll do the spawning.
I'll put the end down here.
Format selection, format document.
So this is true.
We'll do our spawning if this is false.
Unchecked, we won't spawn, but we need to have some sort of wait.
And here, even if this isn't going or will exhaust our resources the way will or the the loop will
run too fast.
And you're not going to share your resources with other things in the game.
You're going to crash your game.
So make sure you have some sort of wait in the loop.
But 5 seconds is pretty good.
Let's go ahead and try this out.
Let's see what we got.
All right.
We should see some zombies.
There's some zombies.
I don't want to kill them all off because I want to make sure that we have two sets of zombies.
Should be for, like, 15 seconds anyway.
Watch this.
Only get them all.
All good.
There's two hanging out.
I couldn't help myself.
I had to.
I had to try to get it.
Try to try to hide it.
Try to kill the zombies.
All right, here we go.
We got three.
Let's look for errors to view.
Oh, here they come.
There's no heirs.
Nice.
So they are living longer than the rounds.
Our time to live is working.
Should we try and get these?
It'll be very satisfying.
There's a whole bunch of them.
Oh, man, I killed only one of them, I think.
Anyway, I'll see you the next next video.
We're going to do a sound.
We're going to do an alarm for our boulder.
Oh, no.
Let's do an alarm for the zombies.
When zombies spawn, we're going to have a klaxon go off.
I thought that'd be pretty cool.
I will see you in the next video.